package o;

import android.content.Context;
import android.graphics.PointF;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import androidx.recyclerview.widget.RecyclerView.LayoutParams;
import androidx.recyclerview.widget.RecyclerView.j;
import androidx.recyclerview.widget.RecyclerView.q;
import androidx.recyclerview.widget.RecyclerView.q.e;
import androidx.recyclerview.widget.RecyclerView.t;

public class mh extends q {
    private final float ʽ;
    protected PointF ˊ;
    protected int ˋ = 0;
    protected final DecelerateInterpolator ˎ = new DecelerateInterpolator();
    protected int ˏ = 0;
    protected final LinearInterpolator ॱ = new LinearInterpolator();

    public mh(Context context) {
        this.ʽ = ˋ(context.getResources().getDisplayMetrics());
    }

    public void ˎ() {
    }

    public void ˋ(View view, t tVar, e eVar) {
        int ˏ = ˏ(view, ˋ());
        int ॱ = ॱ(view, ॱ());
        int ˎ = ˎ((int) Math.sqrt((double) ((ˏ * ˏ) + (ॱ * ॱ))));
        if (ˎ > 0) {
            eVar.ˏ(-ˏ, -ॱ, ˎ, this.ˎ);
        }
    }

    public void ˊ(int i, int i2, t tVar, e eVar) {
        if (ʻ() == 0) {
            ᐝ();
            return;
        }
        this.ˏ = ˏ(this.ˏ, i);
        this.ˋ = ˏ(this.ˋ, i2);
        if (this.ˏ == 0 && this.ˋ == 0) {
            ˊ(eVar);
        }
    }

    public void ˊ() {
        this.ˋ = 0;
        this.ˏ = 0;
        this.ˊ = null;
    }

    protected float ˋ(DisplayMetrics displayMetrics) {
        return 25.0f / ((float) displayMetrics.densityDpi);
    }

    protected int ˎ(int i) {
        return (int) Math.ceil(((double) ˏ(i)) / 0.3356d);
    }

    protected int ˏ(int i) {
        return (int) Math.ceil((double) (((float) Math.abs(i)) * this.ʽ));
    }

    protected int ˋ() {
        if (this.ˊ == null || this.ˊ.x == 0.0f) {
            return 0;
        }
        return this.ˊ.x > 0.0f ? 1 : -1;
    }

    protected int ॱ() {
        if (this.ˊ == null || this.ˊ.y == 0.0f) {
            return 0;
        }
        return this.ˊ.y > 0.0f ? 1 : -1;
    }

    protected void ˊ(e eVar) {
        PointF ˋ = ˋ(ʼ());
        if (ˋ == null || (ˋ.x == 0.0f && ˋ.y == 0.0f)) {
            eVar.ˏ(ʼ());
            ᐝ();
            return;
        }
        ˏ(ˋ);
        this.ˊ = ˋ;
        this.ˏ = (int) (ˋ.x * 10000.0f);
        this.ˋ = (int) (ˋ.y * 10000.0f);
        eVar.ˏ((int) (((float) this.ˏ) * 1.2f), (int) (((float) this.ˋ) * 1.2f), (int) (((float) ˏ(10000)) * 1.2f), this.ॱ);
    }

    private int ˏ(int i, int i2) {
        int i3 = i - i2;
        if (i * i3 <= 0) {
            return 0;
        }
        return i3;
    }

    public int ˏ(int i, int i2, int i3, int i4, int i5) {
        switch (i5) {
            case -1:
                return i3 - i;
            case 0:
                int i6 = i3 - i;
                if (i6 > 0) {
                    return i6;
                }
                i6 = i4 - i2;
                return i6 >= 0 ? 0 : i6;
            case 1:
                return i4 - i2;
            default:
                throw new IllegalArgumentException("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
        }
    }

    public int ॱ(View view, int i) {
        j ˏ = ˏ();
        if (ˏ == null || !ˏ.ʼ()) {
            return 0;
        }
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        return ˏ(ˏ.ʼ(view) - layoutParams.topMargin, ˏ.ˊॱ(view) + layoutParams.bottomMargin, ˏ.ˋˋ(), ˏ.ˉ() - ˏ.ˍ(), i);
    }

    public int ˏ(View view, int i) {
        j ˏ = ˏ();
        if (ˏ == null || !ˏ.ʻ()) {
            return 0;
        }
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        return ˏ(ˏ.ʻ(view) - layoutParams.leftMargin, ˏ.ʽ(view) + layoutParams.rightMargin, ˏ.ˊˊ(), ˏ.ˋˊ() - ˏ.ˋᐝ(), i);
    }
}
